<!--
 * @Author: JPeng 872639397@qq.com
 * @Date: 2021-10-21 22:34:08
 * @LastEditors: JPeng 872639397@qq.com
 * @LastEditTime: 2022-05-11 23:18:37
 * @FilePath: \算法测试\复习！！！\一些知识点\作用域问题.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // function c(){
        //     var a=b=undefined;
        // }
        // c();
        // console.log(b);
        // console.log(a);
        var a="1"
        console.log(a);//1
        if(true){
            var a="2"
            console.log(a);//2
            let b="3"
            console.log(b);//3
        }
        console.log(a);//2
        console.log(b);//报错
    </script>
</body>
</html>